﻿Public MustInherit Class DALBase

    Protected prConnection As System.Data.IDbConnection
    Protected pxTx As System.Data.IDbTransaction

    Protected prConnectionString As String
    Public Property ConnectionString() As String
        Get
            Return prConnectionString
        End Get
        Set(ByVal value As String)
            If (prConnectionString <> value.Trim()) Then
                If prConnection IsNot DBNull.Value Then
                    If prConnection.State <> ConnectionState.Closed Then
                        Throw New ApplicationException("La conexión esta abierta.")
                    End If
                End If
            End If
            prConnectionString = value.Trim()
        End Set
    End Property

    Protected prEsquema As String
    Public Property Esquema() As String
        Get
            Return prEsquema
        End Get
        Set(ByVal value As String)
            prEsquema = value
        End Set
    End Property

    Private _entidadesPersistidas As System.Collections.Generic.List(Of Object)
    Public Property EntidadesPersistidas() As System.Collections.Generic.List(Of Object)
        Get
            Return _entidadesPersistidas
        End Get
        Set(ByVal value As System.Collections.Generic.List(Of Object))
            _entidadesPersistidas = value
        End Set
    End Property

    Public ReadOnly Property IsConnectionClosed() As Boolean
        Get
            Return (prConnection Is DBNull.Value) Or (prConnection.State = ConnectionState.Closed)
        End Get
    End Property

End Class
